$(function() {

    var moveshow = function(type) {
        $('.popup-box').show();
        if (type == "MP4") {
            $('.alert-video').append('<video loop="loop" controls="controls" autoplay="autoplay" preload="none" poster="newimg/video.jpg" src="newimg/video.mp4"></video>');
        } else {
            $('.alert-video').append('<embed src="http://pic.ibaotu.com/00/07/49/96v888piCXab.swf" name="swfPlayer" autostart="true" allowscriptaccess="sameDomain" swliveconnect="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">');
        }
    }

    $('.video-src').click(function() {
        // 这个位置写的视频类型
        //var type = "swf";
        //moveshow(type); 
        var src = $(this).attr('src');
        $('.popup-box').show();
        $('.alert-video').append('<video loop="loop" controls="controls" autoplay="autoplay" preload="none" src="' + src + '"></video>');
    })

    $('.close-btn').click(function() {
        $('.popup-box').hide();
        $(this).siblings().remove();
    });

    // 音频播放
    var isPlay = true,
        $audioInterval = null,
        showTime = 0,
        $toTime = $('#audio0').data("time"),
        $curTime = $('.audio-src .star-time');
    $('.audio-src .audio-box .play-btn').click(function() {
        if (isPlay) {
            // showTime = $thisAudio.attr("timestart") || 1;
            $('#audio0').get(0).play();
            $('.audio-src .souse-img').addClass('running');
            $('.audio-src .move-color').addClass('running').css('animation-duration', $toTime + 's');
            $('#play-btn').toggleClass('icon-bofang1');

            $audioInterval = setInterval(function() {
                fun();
            }, 1000)
        } else {

            clearInterval($audioInterval);
            $('#audio0').attr("timestart", showTime)
            $('.audio-src .souse-img').removeClass('running');
            $('.audio-src .move-color').removeClass('running');
            $('#audio0').get(0).pause();
            $('#play-btn').toggleClass('icon-bofang1');


        }
        isPlay = !isPlay;

        function fun() {

            var minute = showTime / 60;
            var second = showTime % 60;
            if (showTime <= 9) {
                $curTime.text(parseInt('0' + minute) + ":" + '0' + second)
            } else {
                $curTime.text(parseInt('0' + minute) + ":" + second)
            }

            if (showTime == $toTime) {
                clearInterval($audioInterval);
                $curTime.text('0:00');
                $('#play-btn').removeClass('icon-bofang1');
                $('.audio-src .souse-img').removeClass('running');
                $(',audio-src .move-color').removeClass('running');

                that.isPlay = true;
                showTime = 1;
            }
            showTime++;


        }


    });
	//浏览页异步请求统计
	var picid = $('.collect-wrap>.icon-shoucang1').attr('data-id');
	var httpReferer = $("#httpReferer").val();
	$.ajax({
		type:'get',
		url:'http://ibaotu.com/?m=show&a=ajaxRedis',
		data:{id:picid,httpReferer:httpReferer},
		dataType:'json',
		success:function(rs){
		}
	});

})
$(function(){
var pdfWrap =  $('.pdf-wrap');
$('.view-tutorial').click(function(){
    var auth_uid = $('.baotu-id').text();
		//alert(auth_uid)
		if(auth_uid == ""){
			_login('登录网站', '登录后可查看教程');
			return false;
		}
    var pdfWrap =  $('.pdf-wrap');
    pdfWrap.show();
    
    
        $('.canvas-box').html();
    
    pdfWrap.css('left',0);
});
$('.pdf-close').click(function(){
    pdfWrap.css('left','-110%');  
});
})
